package com.poster.constant;

import com.poster.utils.StringUtils;

import java.util.*;

public class RedisConstant {
    private RedisConstant(){}

    private static final String BASE = "poster";
    public static final String ROLE_PERMISSION_MAP = linkBase("role-permission-map");


    public final static int EXPIRE_ONE_MINUTE = 60;
    public final static int EXPIRE_ONE_HOUR = EXPIRE_ONE_MINUTE * 60;
    public final static int EXPIRE_ONE_DAY = EXPIRE_ONE_MINUTE * 60;


    public static String link(String prefix, String suffix) {
        if (StringUtils.isEmpty(prefix) || StringUtils.isEmpty(suffix)){
            return "";
        }
        return prefix + ':' + suffix;
    }

    public static String link(String prefix, List<String> suffix) {
        if (StringUtils.isEmpty(prefix) || suffix == null || suffix.isEmpty()){
            return "";
        }
        return prefix + ':' + String.join(":", suffix);
    }

    public static String linkBase(String suffix) {
        return link(BASE, suffix);
    }

    public static String linkBase(List<String> suffix) {
        return link(BASE, suffix);
    }

    public static void main(String[] args) {
         System.out.println(linkBase(List.of("1", "2")));
    }
}
